<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header">
</head>
<link rel="stylesheet" th:href="@{/css/yw.css}">
<body class="hold-transition skin-blue sidebar-mini">
<section class="content-header">
    <h1>
       预算成本数据编辑
    </h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目信息</label>
                                    <input type="text" name="code" class="form-control" placeholder="请输入厂内编号或名称">
                                </div>
                                <!--<div class="form-group" style="margin-right: 10px;">-->
                                    <!--<label>需方</label>-->
                                    <!--<input type="text" name="demander" class="form-control" placeholder="请输入材质">-->
                                <!--</div>-->
                                <!--<div class="form-group" style="margin-right: 10px;">-->
                                    <!--<label>安装地点</label>-->
                                    <!--<input type="text" name="address" class="form-control" placeholder="请输入品级">-->
                                <!--</div>-->
                                <!--<div class="form-group" style="margin-right: 10px;">-->
                                <!--<label>设计科室</label>-->
                                <!--<input type="text" name="designDepts" class="form-control" placeholder="请输入具体位置">-->
                                <!--</div>-->

                                <!--<div class="form-group" style="margin-right: 10px;margin-top: 5px;">-->
                                    <!--<label>设计类别</label>-->
                                    <!--<select name="projectClassify" class="form-control" style="width:200px;" id="eqmFkTypeEdit">-->
                                        <!--<option value="" selected="selected">全部</option>-->
                                        <!--<option  value="1">设计</option>-->
                                        <!--<option  value="2">非设计</option>-->
                                    <!--</select>-->
                                <!--</div>-->

                                <div class="form-group" style="margin-right: 10px;">
                                    <label>录入状态</label>
                                    <select name="isInputStatus" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option  value="-1">未开始</option>
                                        <option  value="1">执行中</option>
                                        <option  value="2">已完结</option>
                                    </select>
                                </div>

                                <div class="form-group" style="margin-right: 10px;">
                                    <label>机械成本编辑状态</label>
                                    <select name="isJXStatus" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option  value="-1">未开始</option>
                                        <option  value="1">执行中</option>
                                        <option  value="2">已完结</option>
                                    </select>
                                </div>

                                <div class="form-group" style="margin-right: 10px;">
                                    <label>自动化成本编辑状态</label>
                                    <select name="isZDHStatus" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option  value="-1">未开始</option>
                                        <option  value="1">执行中</option>
                                        <option  value="2">已完结</option>
                                    </select>
                                </div>

                                <div class="form-group" style="margin-right: 10px;">
                                    <label>流体成本编辑状态</label>
                                    <select name="isLTStatus" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option  value="-1">未开始</option>
                                        <option  value="1">执行中</option>
                                        <option  value="2">已完结</option>
                                    </select>
                                </div>

                                <button type="button" class="btn btn-success" id="btn-search" style="margin-top: 5px;">
                                    <!--<i class="fa fa-search"></i>-->
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table" style="table-layout: fixed;word-break:break-all; word-wrap:break-word;"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer">
</div>
<!--<script th:src="@{/js/yw.js}"></script>-->
<script th:inline="javascript">
    /**
     * 表格搜索
     */
    $("#btn-search").click(function () {
        js.table.search(table);
    });

    /** 加载用户表格 */
    table = js.table.init({
        url: ctx + "baseCost/projectCostList",
        showColumns: false,
        showExport: false,
        // pageSize:300,
        pagination : false,
        columns: [
            {
                title: '序号', field: 'id', width: '50',
                formatter: function (value, row, index, field) {
                    var pageSize = table.bootstrapTable('getOptions').pageSize;
                    var pageNumber = table.bootstrapTable('getOptions').pageNumber;
                    return pageSize * (pageNumber - 1) + index + 1;
                }
            },

            { title: "项目编号", field: 'code'},
            { title: "项目名称", field: 'name'},
            { title: "需方", field: 'demander'},
            { title: "数量", field: 'num'},
            { title: "单位", field: 'unit'},
            { title: "安装地点", field: 'address'},
            // { title: "设计部门", field: 'designDepts'},
            { title: "设计类别", field: 'projectClassify',
                formatter: function(value, row, index){
                    if(value==1){
                        return '设计';
                    }else if(value==2){
                        return '非设计';
                    }else{
                        return '';
                    }
                }
            },
            { title: "录入状态", field: 'cjx',
                formatter: function(value, row, index){
                    var actions = [];
                    if((row.cjx=='' && row.czdh=='' && row.clt=='')|| (row.cjx==0 && row.czdh==0 && row.clt==0)) {
                        actions.push('<span class="label  badge  label-default"> 未开始</span> ');
                    }
                    else if(row.cjx==row.jxPlan && row.czdh==row.zdhPlan &&row.ltPlan==row.clt){
                        actions.push('<span class="label  badge  label-success"> 已完结</span> ');
                    }
                    else {
                        actions.push('<span class="label  badge  label-warning"> 执行中</span> ');
                    }
                    return actions.join('');
                }
            },
            { title: "机械成本编辑", field: 'cjx',
                formatter: function(value, row, index){
                    var actions = [];

                    if(''==row.cjx || 0==row.cjx ) {
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=1"> 未开始</a> ');
                    }
                    else if(row.jxPlan==row.cjx && row.cjx!=0 && row.cjx!=''){
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=1"> 已完结</a> ');
                    }
                    else {
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=1"> 执行中</a> ');
                    }
                    return actions.join('');
                }
            },
            { title: "自动化成本编辑", field: 'czdh',
                formatter: function(value, row, index){
                    var actions = [];
                    if(''==row.czdh || 0==row.czdh ) {
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=2"> 未开始</a> ');
                    }
                    else if(row.zdhPlan==row.czdh && row.czdh!=0 && row.czdh!=''){
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=2"> 已完结</a> ');
                    }
                    else {
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=2"> 执行中</a> ');
                    }
                    return actions.join('');
                }
            },
            { title: "流体成本编辑", field: 'clt',
                formatter: function(value, row, index){
                    var actions = [];
                    if(''==row.clt || 0==row.clt ) {
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=3"> 未开始</a> ');
                    }
                    else if(row.ltPlan==row.clt && row.clt!=0 && row.clt!=''){
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=3"> 已完结</a> ');
                    }
                    else {
                        actions.push('<a class="btn btn-primary btn-xs" href="' + ctx + 'costDetailBoard?id= ' + row.id + '&code='+ row.code + '&name='+ row.name + '&demander='+ row.demander + '&num='+ row.num + '&address='+ row.address + '&projectClassify='+ row.projectClassify + '&kind=0&designType=3"> 执行中</a> ');
                    }
                    return actions.join('');
                }
            }
        ]
    });


</script>